//
//  DetailViewController.m
//  chanyou
//
//  Created by wanli on 15/1/7.
//  Copyright (c) 2015年 wanli. All rights reserved.
//

#import "DetailViewController.h"
#import "FeedBackViewController.h"
#import "OffLineBrowseViewController.h"
#import "SettingViewController.h"

#import "TeamViewController.h"

@interface DetailViewController ()

@end

@implementation DetailViewController
- (void)dealloc
{
    [_item release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.item = [NSArray arrayWithObjects:@"反馈", @"清除缓存", @"关于游遇", nil];
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(self.view.frame.size.width / 3 * 2, 0, self.view.frame.size.width, 130)];
    tableView.delegate = self;
    tableView.dataSource = self;
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"tableCell"];
    [self.view addSubview:tableView];
    [tableView release];
    // Do any additional setup after loading the view.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tableCell"];
    cell.textLabel.text = [_item objectAtIndex:indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (indexPath.row == 0){
        FeedBackViewController *feedBack = [[FeedBackViewController alloc] init];
        UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:feedBack];
        [self presentViewController:controller animated:NO completion:nil];
        [feedBack release];
        [controller release];
        
    } else if (indexPath.row == 1){
        
        SettingViewController *setting = [[SettingViewController alloc]init];
        UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:setting];
        [self presentViewController:controller animated:NO completion:nil];
        [setting release];
        [controller release];

        
    } else if (indexPath.row == 2){
        
        TeamViewController *team = [[TeamViewController alloc] init];
        UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:team];
        [self presentViewController:controller animated:NO completion:nil];
        [team release];
        [controller release];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




@end
